import logging

from config import URL


class TenderApi:

    def __init__(self, session):
        # 获取session对象
        self.session = session

    # 投资接口
    def tender(self, id_v, amount_v, depos_v=-1):
        url = URL + "/trust/trust/tender"
        form_dict = {'id': id_v, 'depositCertificate': depos_v, 'amount': amount_v}
        resp = self.session.post(url=url, data=form_dict)
        logging.info(f"投资接口返回的响应体数据：{resp.json()}")
        return resp

    # 第三方投资接口
    def third_tender(self, url, form_dict):
        resp = self.session.post(url=url, data=form_dict)
        logging.info(f"第三方投资接口返回的响应体数据：{resp.text}")
        return resp
